<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function Pet(){
				this.animal="";
				this.name="";
				this.setAnimal=function(newAnimal)
				{
					this.animal=newAnimal;
				}
				this.setName = function(newName)
				{
					this.name=newName;
				}
				this.show=function()
				{
					document.write(this.name+","+this.animal)
				}
			}			
			
			var mycat = new Pet();
			mycat.setAnimal("cat");
			mycat.setName("sylvester");
			mycat.show();
			
			
			function Dog()
			{
				this.breed="";
				this.setBreed=function(newBreed){
					this.breed=newBreed;
				}
			}
			Dog.prototype=new Pet();
			
			var myDog = new Dog();
			myDog.setName("小花");
			myDog.setBreed("Greyhoud");
			alert(myDog.name+"is a"+myDog.breed)
			
		</script>
	</head>
	<body>
	</body>
</html>
